/**
 * Created by bing on 2019/3/8.
 */
package com.wxb.springboot.springmvc.config;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;

import java.util.HashMap;

/**
 * describe:
 *
 * @author : wxbing000@gmail.com
 * @version : v1.0
 * @date : 2019-03-08 11:25
 */
//@Configuration
public class WebConfig implements BeanFactoryAware {

	private BeanFactory beanFactory;

	public void createSimpleUrlHandlerMapping() {
		HashMap<String, Object> urlMap = new HashMap<String, Object>();
		urlMap.put("/page", "modelAttributeController");

		SimpleUrlHandlerMapping simpleUrlHandlerMapping = beanFactory.getBean(SimpleUrlHandlerMapping.class);

		simpleUrlHandlerMapping.setUrlMap(urlMap);
	}


	@Override
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		this.beanFactory = beanFactory;
	}
}